package com.vvlive.caibao.smartcity.view;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.vvlive.caibao.smartcity.utils.ScreenUtil;

import java.lang.reflect.Method;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by zhj on 2015/10/27.
 */
public class CellEventCard extends LinearLayout {

    private ScreenUtil mScreen;
    private int padding;
    private LinearLayout.LayoutParams mLayoutParams;

    public CellEventCard(Context context) {
        this(context, null);
    }

    public CellEventCard(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        this.setBackgroundResource(R.drawable.shape_hour_index_border);
        this.setOrientation(VERTICAL);
        this.mScreen = new ScreenUtil(context);
        padding = (int) mScreen.dip2px(8);
        mLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        mLayoutParams.setMargins(0, 0, 0, (int) mScreen.dip2px(4));
    }

    public void addItem(String text) {
        TextView item = new TextView(getContext());
        item.setBackgroundResource(R.drawable.shape_contact_tab_checked);
        item.setTextSize(12);
        item.setText(text);
        item.setLayoutParams(mLayoutParams);
        item.setPadding(padding, padding, padding, padding);
        this.addView(item);
    }
}
